﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DebitNote.aspx.cs" Inherits="Main_ServiceInvoice_TransactionFormat_DebitNote" %>

<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Debit Note Format</title>
    <link href="../../../Styles/accounts.css" rel="stylesheet" type="text/css" />

   <%-- <script src="../../../Menu/js/jquery.min.js" type="text/javascript"></script>--%>
<script src="../../../JavaScript/jquery-1.4.2.min.js" type="text/javascript"></script>

    <link href="../../../Styles/HorizontalTab.css" rel="stylesheet" type="text/css" />

    <script src="../../../JavaScript/HorizontalTab.js" type="text/javascript"></script>

    <script type="text/javascript">
        function PageSettings() {
            var chk = document.getElementById("chkPageSettings");

            if (chk.checked == true) {

                document.getElementById("txtHeaderMargin").value = "0.5";
                document.getElementById("txtHeaderMargin").disabled = true;
                document.getElementById("txtFooterMargin").value = "0.5";
                document.getElementById("txtFooterMargin").disabled = true;
            }
            else {
                document.getElementById("txtHeaderMargin").value = "";
                document.getElementById("txtHeaderMargin").disabled = false;
                document.getElementById("txtFooterMargin").value = "";
                document.getElementById("txtFooterMargin").disabled = false;
            }
        }

        function EnableTextboxoncheck() {
            var chk = document.getElementById("chkBillCaption");
            var chkbeforedetail = document.getElementById("chkInfoBeforeDetails");
            var chkNote = document.getElementById("chkNote");

            if (chk.checked == true) {

                document.getElementById("txtBillCaption").disabled = false;
            }
            else {
                document.getElementById("txtBillCaption").disabled = true;
            }

            if (chkbeforedetail.checked == true) {

                document.getElementById("txtInfoBeforeDetails").disabled = false;
            }
            else {
                document.getElementById("txtInfoBeforeDetails").disabled = true;
            }

            if (chkNote.checked == true) {

                document.getElementById("txtNote").disabled = false;
            }
            else {
                document.getElementById("txtNote").disabled = true;
            }
        }
        function blanknotallow() {

            if (document.getElementById("txtBillCaption").disabled == false && document.getElementById("txtBillCaption").value == "") {
                alert("Bill Caption cannot be blank!");
                document.getElementById("txtBillCaption").focus();
                return false;
            }

            if (document.getElementById("txtInfoBeforeDetails").disabled == false && document.getElementById("txtInfoBeforeDetails").value == "") {
                alert("Information Before Details cannot be blank!");
                document.getElementById("txtInfoBeforeDetails").focus();
                return false;
            }

            if (document.getElementById("txtNote").disabled == false && document.getElementById("txtNote").value == "") {
                alert("Note cannot be blank!");
                document.getElementById("txtNote").focus();
                Flag = false;
                return false;
            }
            return true;
        }
        function isNumberKey(control_id, evt) {
            var charCode = (evt.which) ? evt.which : event.keyCode
            if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 45 || charCode >= 47))
                return false;

            if (charCode == 46) {
                var dotcount = document.getElementById(control_id).value.split('.').length - 1;
                if (dotcount >= 1) {
                    return false;
                }

            }
            return true;
        }
        function RequiredField() {
            var Flag = true;
            if (document.getElementById("txtFormatName").value == '') {
                alert('Specify Debit Note Format Name');
                document.getElementById("txtFormatName").focus();
                Flag = false;
            }
            var isvalid = blanknotallow();

            if (Flag == true && isvalid == true) {
                return true;
            }
            else {
                return false;
            }
        }
        function FillZero(id) {
            var ctrlValue = document.getElementById(id).value;
            var zero = 0;
            if (ctrlValue == '') {
                document.getElementById(id).value = parseFloat(zero).toFixed(2);
            }
            else {
                document.getElementById(id).value = parseFloat(ctrlValue).toFixed(2);
            }
            return true;
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="divmain">
        <acc:heading ID="header1" runat="server" HeadingText="Debit Note" />
    </div>
    <div style="width: 90%; margin-left: 5%; margin-right: 5%; text-align: center">
        <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
    </div>
    <asp:Panel ID="PnlAddNew" runat="server" Visible="false">
        <div style="width: 90%; margin-left: 5%; margin-right: 5%" class="tablecontent">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:HiddenField ID="hidFormatId" runat="server" Value="0" />
                    <asp:HiddenField ID="hidTypeId" runat="server" Value="-1" />
                    <table style="width: 100%">
                        <tr>
                            <td class="headtd" colspan="3">
                                Debit Note Format
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 25%">
                                Format Name<span style="color: Red">*</span>
                            </td>
                            <td style="width: 30%">
                                <asp:TextBox ID="txtFormatName" MaxLength="50" ToolTip="Format Name" runat="server"
                                    Width="180px" CssClass="input"></asp:TextBox>
                            </td>
                            <td style="width: 45%">
                                <asp:CheckBox ID="chkDefualt" runat="server" Text="Set as Default" />
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div id="wrapper">
            <ul class="tabs">
                <li><a href="javascript:void(0)" class="defaulttab" rel="tabOptions">Options</a></li>
                <li><a href="javascript:void(0)" rel="tabNumberSettings">Number Settings</a></li>
                <li><a href="javascript:void(0)" rel="tabReports">Reports</a></li>
            </ul>
            <div class="tab-content" id="tabOptions" runat="server">
                <div style="margin-left: 10px;">
                    <table>
                        <tr>
                            <td>
                                <asp:CheckBox ID="chkReferenceNumber" runat="server" Text="Reference Number" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:CheckBox ID="chkCheckedBy" runat="server" Text="Checked By" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:CheckBox ID="chkNarration" runat="server" Text="Narration" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:CheckBox ID="chkPreparedBy" runat="server" Text="Prepared By" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:CheckBox ID="chkRemarks" runat="server" Text="Remarks" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:CheckBox ID="chkPrinOnSave" runat="server" Text="Print On Save" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="tab-content" id="tabNumberSettings" runat="server">
                <div style="margin-left: 10px;">
                    <table style="width: 100%">
                        <tr>
                            <td>
                                Type
                            </td>
                            <td>
                                Prefix
                            </td>
                            <td>
                                Starting No
                            </td>
                            <td>
                                Suffix
                            </td>
                            <td>
                                Width of The No.
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:DropDownList ID="ddlType" runat="server" CssClass="dropdown">
                                    <asp:ListItem Value="0" Text="Manual"></asp:ListItem>
                                    <asp:ListItem Value="1" Text="Automatic" Selected="True"></asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:TextBox ID="txtPrefix" runat="server" Width="80px" CssClass="input" MaxLength="10"></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox ID="txtStartNo" runat="server" Width="80px" CssClass="input" Text="1"
                                    MaxLength="6" onKeyPress="return isNumberKey(this.id,event)" Style="text-align: right"></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox ID="txtSuffix" runat="server" Width="80px" CssClass="input" MaxLength="10"></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox ID="txtWidthofNo" runat="server" Width="80px" CssClass="input" MaxLength="1"
                                    onKeyPress="return isNumberKey(this.id,event)" Style="text-align: right"></asp:TextBox>
                            </td>
                            <td>
                                <asp:CheckBox ID="chkResetYear" runat="server" Text="Reset Every Year" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="6">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="tab-content" id="tabReports" runat="server">
                <div style="margin-left: 10px;">
                    <table width="100%">
                        <tr>
                            <td valign="top" style="width: 40%">
                                <table width="100%">
                                    <tr>
                                        <td style="width: 100%">
                                            <asp:CheckBox ID="chkBillCaption" runat="server" onclick="return EnableTextboxoncheck();"
                                                Text="Bill Caption" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:TextBox ID="txtBillCaption" Enabled="false" MaxLength="250" runat="server" onblur="return blanknotallow();"
                                                CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Firm Caption
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:TextBox ID="txtFirmCaption" MaxLength="255" runat="server" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:CheckBox ID="chkInfoBeforeDetails" onclick="return EnableTextboxoncheck();"
                                                runat="server" Text="Information Before Details" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:TextBox ID="txtInfoBeforeDetails" Enabled="false" MaxLength="250" onblur="return blanknotallow();"
                                                runat="server" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:CheckBox ID="chkNote" onclick="return EnableTextboxoncheck();" runat="server"
                                                Text="Note" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:TextBox ID="txtNote" runat="server" Enabled="false" onblur="return blanknotallow();"
                                                MaxLength="250" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-top: 7px">
                                            <asp:CheckBox ID="chkPrintLogo" runat="server" Text="Print Logo" />
                                        </td>
                                    </tr>
                                    <%-- <tr>
                                <td>
                                     <asp:HiddenField ID="hidFileUpload" runat="server" />
                                   <asp:FileUpload ID="fileUploadLogo" runat="server" ToolTip="Upload Logo" />
                                </td>
                            </tr>--%>
                                </table>
                            </td>
                            <td valign="top" style="width: 60%">
                                <table class="tablecontent" width="100%">
                                    <tr>
                                        <td colspan="4" class="headtd" style="width: 100%">
                                            <asp:CheckBox ID="chkPageSettings" onclick="return PageSettings();" runat="server"
                                                Text="Page Settings" />&nbsp;&nbsp;&nbsp;(Default 0.5F)
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Header Margin
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtHeaderMargin" runat="server" MaxLength="5" Text="0.50" onkeypress="return isNumberKey(this.id,event);"
                                                onblur="return FillZero(this.id); " CssClass="inputnumber"></asp:TextBox>
                                        </td>
                                        <td>
                                            Footer Margin
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtFooterMargin" runat="server" MaxLength="5" Text="0.50" onkeypress="return isNumberKey(this.id,event);"
                                                onblur="return FillZero(this.id); " CssClass="inputnumber"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Paper Size
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlPaperSize" runat="server" CssClass="dropdown">
                                                <asp:ListItem Text="A4- One Bill Per Page" Value="0"></asp:ListItem>
                                                <asp:ListItem Text="A4- Two Bills per Page" Value="1"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                        <td>
                                            No. of Copies
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtNoOfCopy" MaxLength="3" runat="server" Text="1" onkeypress="return isNumberKey(this.id,event);"
                                                CssClass="inputnumber"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                                <table class="tablecontent" width="100%" style="margin-top: 5px">
                                    <tr>
                                        <td style="width: 50%">
                                            <asp:CheckBox ID="chkReportFirmNameAddress" runat="server" Text="Firm Name and Address" />
                                        </td>
                                        <td style="width: 50%">
                                            <asp:CheckBox ID="chkReportPreparedBy" runat="server" Text="Prepared By" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:CheckBox ID="chkReportCustomerName" runat="server" Text="Customer Name and Address" />
                                        </td>
                                        <td>
                                            <asp:CheckBox ID="chkReportCheckedBy" runat="server" Text="Checked By" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:CheckBox ID="chkReportSTRegNo" runat="server" Text="ST Reg. No." />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:CheckBox ID="chkReportOutStandingSummary" runat="server" Text="Out Standing Summary" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div style="width: 90%; margin-left: 5%; margin-right: 5%; text-align: center">
            <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="button" OnClientClick="return RequiredField();"
                OnClick="btnSave_OnClick" />&nbsp;
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="button" OnClick="btnCancel_OnClick" />
        </div>
    </asp:Panel>
    <asp:Panel ID="PnlView" runat="server" Visible="false">
        <div style="width: 90%; margin-left: 5%; margin-right: 5%; margin-top: 15px;">
            <asp:GridView ID="grdDisplay" runat="server" CssClass="gridview" Width="100%" DataKeyNames="FormatId"
                AlternatingRowStyle-CssClass="gridview_alternate" OnRowDataBound="grdDisplay_OnRowDataBound"
                OnSelectedIndexChanged="grdDidplay_OnSelectedIndexChanged" AutoGenerateColumns="false">
                <Columns>
                    <asp:TemplateField HeaderText="S.No." ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%#Container.DataItemIndex+1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="Format Name" DataField="FORMATNAME" ItemStyle-HorizontalAlign="Left" />
                    <asp:BoundField HeaderText="Default" DataField="SETASDEFAULT" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Checked By" DataField="CHECKEDBY" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Prepared By" DataField="PREPAREDBY" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Ref. No." DataField="REFERENCENUMBER" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Remarks" DataField="REMARKS" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Narration" DataField="NARRATION" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Print On Save" DataField="PRINTONSAVE" ItemStyle-HorizontalAlign="Center" />
                    <asp:CommandField ShowSelectButton="true" ItemStyle-HorizontalAlign="Center" HeaderText="Edit"
                        ButtonType="Image" SelectImageUrl="~/Menu/images/Edit_user.png" />
                </Columns>
            </asp:GridView>
        </div>
    </asp:Panel>
    </form>
</body>
</html>
